function List(name) {
    this.name = name;
    this.next = null;
}

function reserveListMN(head, m, n) {
    let dummy_node = new List(0);
    dummy_node.next = head

    let pre = dummy_node
    for (let i = 0; i < m - 1; i++) {
        pre = pre.next;
    }

    let curr = pre.next;
    for (let i = 0; i < n - m - 1; i++) {
        let next = curr.next;
        curr.next = next.next;
        next.next = curr;
        pre.next = next;
    }

    return dummy_node.next;
}